package org.lee.app;

import lombok.extern.slf4j.Slf4j;
import org.lee.app.cuisine.ICuisine;

import java.util.ArrayList;
import java.util.List;

/**
 * Waiter
 * 服务员：小二
 *
 * @author dralee
 * @date 2021-11-23 10:49:49
 **/
@Slf4j
public class Waiter {

    private List<ICuisine> cuisineList = new ArrayList<>();

    public void order(ICuisine cuisine) {
        cuisineList.add(cuisine);
    }

    public synchronized void placeOrder() {
        for (ICuisine cuisine : cuisineList) {
            cuisine.cook();
        }
        cuisineList.clear();
    }
}
